package com.service;

import com.dao.MenuDao;
import com.po.UserPO;
import com.util.MenuUtil;
import com.vo.MenuVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author linyukun
 * @date 2022/7/6 19:50
 */
@Service
public class MenuServiceImpl {

    @Autowired
    private MenuDao menuDao;

    public List<MenuVo> getMenuByMember(UserPO userPO) {
        List<MenuVo> menulist = this.menuDao.findAllMenu();
        if(StringUtils.isBlank(userPO.getPowerReadList())){//是否含有读权限列表
            //权限列表为空
            return new ArrayList<>();
        }else{////返回权限列表
            return MenuUtil.setMenuRelative(menulist,userPO.getPowerReadList());
        }
    }
}
